$(function(){

	var text = $(".pic");

	var button = $(".upload");

	var fileType = "pic",fileNum = "one";

	new AjaxUpload(button,{
		action: APP+'/User/uploads',
		name: 'pic',
		onSubmit : function(file, ext){
			if(fileType == "image")
			{
				if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)){
					this.setData({
						'info': '文件类型为图片'
					});
				} else {
					alert('非图片类型文件，请重传');
					return false;
				}
			}
		},
		onComplete: function(file, response){
			if(isNaN(response[0])){
				alert(response);

			}else{
				text.val(response);
				$(".ren img").attr('src', PUBLIC+"/Content/tmp/"+response);
			}
		}
	});


});
